4单选设F是由T1,T2,T3三棵树组成的森林,其中T1,T2,T3的结点数分别为n1,n2和n3,与F对应的二叉树为B,则二叉树B的左子树中有_____________个结点(单选)AssumethatFisaforest,madeupoftreeT1,T2,T3,andthenodenumbersofT1,T2,T3aren1,n2,n3.LetBbethecorrespondingbinarytreeofF,thenB’sleftsub-treewillhas__________nodes.(Thereisonlyonecorrectanswer)
A.n1-1
B.n3-1
C.n2
D.n2-1
5单选将一棵树T转换为左子/右兄链表表示的二叉树B,则T的后根次序遍历序列是B的相应_________序列。(单选)TransformatreeTintoabinarytreeB,whichisrepresentedbyLeft-Child/Right-Siblingimplementation.Thenthepost-ordertraversalsequenceofTisthesameasthe__________sequenceofB.(Thereisonlyonecorrectanswer)
A.前序遍历
B.层次遍历
C.后序遍历
D.中序遍历
6多选2-3树是一种特殊的树,它满足两个条件:(1)每个内部结点有两个或三个子结点;(2)所有的叶结点到根的路径长度相同;如果一棵2-3树有9个叶结点,那么它可能有_________个非叶结点。(多项)2-3treeisaspecialkindoftree,itsatisfy:(1)Everyinternalnodehas2or3childnodes.(2)Alltheleafnodeshavethesamelengthofthepathtotherootnode.Ifa2-3treehas9leafnodes,thenitmayhave__________non-leafnodes.(Therearemorethanonecorrectanswers)
A.5
B.7
C.4
D.6
7填空给出一棵树的逻辑结构T=(N,R),其中:N={A,B,C,D,E,F,G,H,I,J,K}R={r}r={(A,B),(B,E),(B,F),(F,G),(F,H),(A,C),(C,I),(C,J),(J,K),(A,D)}Givenalogicalstructureofatree,T=(N,R),andN={A,B,C,D,E,F,G,H,I,J,K},R={r},r={(A,B),(B,E),(B,F),(F,G),(F,H),(A,C),(C,I),(C,J),(J,K),(A,D)}试回答下列问题:Pleaseanswerthesequestions:(1)哪个是根结点?whichistherootnode?(2)哪些是F的孩子?whicharethechildnodesofNodeF?(3)结点K的层次是多少?(注:根的层数为0,独根树深度为0,高度为1,其他题目同样如此;同一个选项的答案如果有多个字母,按照字典序排列,且不要以空格分隔)(P.S.theleveloftherootnodeis0,thedepthofatree,whichonlyhasarootnode,is0,anditsheightis1.Otherproblemshavethesameregulations.Ifthereareseveralalphabetsinonequestion,orderthembylexicographicalorder,anddonotaddspaces.)
8填空给出一棵树的逻辑结构T=(N,R),其中:N={A,B,C,D,E,F,G,H,I,J,K}R={r}r={(A,B),(B,E),(B,F),(F,G),(F,H),(A,C),(C,I),(C,J),(J,K),(A,D)}试回答下列问题:Givenalogicalstructureofatree,T=(N,R),andN={A,B,C,D,E,F,G,H,I,J,K},R={r},r={(A,B),(B,E),(B,F),(F,G),(F,H),(A,C),(C,I),(C,J),(J,K),(A,D)}Pleaseanswerthesequestions:(1)哪个是F的父结点?whichistheparentnodeofNodeF?(2)哪些是B的子孙?whicharetheoffspringofNodeB?(3)以结点C为根的子树的深度是多少?whatisthedepthofthesub-treewhoserootnodeisNodeC?(注:根的层数为0,独根树深度为0,高度为1,其他题目同样如此;各个选项之间的答案用空格分隔就好;同一个选项的答案如果有多个字母,按照字典序排列,且不要以空格分隔)(P.S.theleveloftherootnodeis0,thedepthofatree,whichonlyhasarootnode,is0,anditsheightis1.Otherproblemshavethesameregulations.Ifthereareseveralalphabetsinonequestion,orderthembylexicographicalorder,anddonotaddspaces.)
数据结构与算法
北京大学
军职在线答案
大学网课